﻿@model Tasks.UI.Models.Account.EnterpriseEditModel
@{
    ViewBag.Title = "EditEnterpriseMember";
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>编辑企业信息</title>
    <link href="@Config.GetCssResourcePath("main.css")" rel="stylesheet" type="text/css" />
    <link href="@Config.GetCssResourcePath("table.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-impromptu.3.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.combobox.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/global.js")" type="text/javascript"></script>
    <script type="text/javascript">


        //修改密码
        function ChagePassword(UserID) {
            $("#UserID").val(UserID);
            $("#act").val("ChagePassword");
            $("form").submit();
        }
        //保存
        function Save(UserID) {
            $("#UserID").val(UserID);
            $("#act").val("Save");
            $("form").submit();
        }

        $(document).ready(function () {
            initProvince("#ProvinceID");
            initCity("#CityID");
            $.ctrl.employeeDropdownList("SalesmanIDName", "SalesmanID"); //绑定业务员下拉框
            $.ctrl.employeeDropdownList("CustomerServiceIDName", "CustomerServiceID"); //绑定企业下拉框


            // 手机号码验证
            jQuery.validator.addMethod("isMobile", function (value, element) {
                var length = value.length;
                return this.optional(element) || (length == 11 && /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test(value));
            }, "请正确填写您的手机号码");

            // 邮政编码验证
            jQuery.validator.addMethod("isZipCode", function (value, element) {
                var tel = /^[0-9]{6}$/;
                return this.optional(element) || (tel.test(value));
            }, "请正确填写您的邮政编码");

            $("form").validate({
                showErrors: function (errorMap, errorList) {
                    $.Msg.errorTips("您的表单填写不完整:", 0, errorList);
                },
                rules: {
                    Name: "required",
                    MobileNo: { isMobile: true }
                },
                messages: {
                    Name: { required: "请填写名称" },
                    MobileNo: { isMobile: "请填写手机号码" }
                },
                /* 获得焦点时不验证 */
                focusInvalid: false,
                onfocusout: false,
                onkeyup: false

            });
            $("#CategoryName").combobox({
                ColumnsMapsNodeName: 'ID|Name',
                TagObject: null,
                MustMatching: false,
                ListWidth: 250,
                DisplayHead: true,
                ListType: ListType.Combobox,
                DataType: DataType.Xml,
                DataLoadOnce: false,
                RemoteUrl: "/data/getxmldata?datatype=categorys&keyword=",
                TextFormat: 'V1',
                ValueFormat: 'V0,V1',
                OnItemClickEvent: function (src, data) {
                    var arrmp = data.value.split(",");
                    $("#CategoryID").attr("value", arrmp[0]);
                    $("#CategoryName").attr("value", arrmp[1]);
                },
                HeadColumn: [
            { name: "编号", width: 60 },
            { name: "名称" }
            ],
                KeyWordColumn: '',
                Buttons: [
            { text: "添加", event: function () { parent.showModalDialog('/Dict/Manage?dictKey=ENT_MEMBER_CAT', false); } }
            ]
            });

        });

        function goto(act) {
            $("#act").val(act);
            $("form").submit();
        }
    </script>
</head>
<body>
    @using (Html.BeginForm())
    {
        <div id="container">
            <input id="UserID" name="UserID" type="hidden"  value="@Model.UserID"/>
            <input id="act" name="act" type="hidden" />
            <div class="navTitle">
                <ul>
                    <li class="Home SecondLast"><a href="index.php">
                        <div class="HomeIcon">
                        </div>
                        <font><font>Home</font></font></a></li><li class="Last"><span><font><font>编辑企业会员</font></font></span></li>
                </ul>
            </div>
            <h1>
                <font><font class="">编辑：</font></font><a href="#" style="color: #005FA3" id="ViewsMenuButton"
                    class="PopDownMenu"><font><font class="">企业会员</font></font><img width="8" height="5"
                        src="/images/arrow_blue.gif" border="0"></a>
            </h1>
            <p class="intro">
                <font>企业名称、账号密码为必填项。添加完企业后请为企业分配权限。 </font>
            </p>
            @Html.OutputMessage(Model.Message, Model.MessageType)
            <div id="horizontal" class="pageBody">
                <strong>账户信息</strong>
                <hr />
                <table>
                    <tr>
                        <td style="width: 80px;">
                            企业名称：
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.Name, new { style = "width:400px;" })
                        </td>
                    </tr>
                    <tr>
                        <td>
                            企业类型：
                        </td>
                        <td>
                            @Html.DropDownList("EnterpriseType", PageHelper.EnterpriseTypeSelector(Model.EnterpriseType))
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp简&nbsp&nbsp称&nbsp：
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.Alias)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp账&nbsp&nbsp号&nbsp：
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.AccountNo)
                            <b class="b">
                                @Model.error
                            </b><span>开通登录权限: </span>@Html.CheckBox("IsDistribution")
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp密&nbsp&nbsp码&nbsp：
                        </td>
                        <td>@Html.PasswordFor(t => t.Password)
                            <b class="b">@(Model.ChagePassworderror)</b>
                            @if (@Model.UserID != 0)
                            {
                                <a href="javascript:void(0)" onclick="ChagePassword(@Model.UserID)">修改密码</a> 
                            }
                        </td>
                    </tr>
                    <tr>
                        <td>
                            手机号码：
                        </td>
                        <td>
                            @Html.TextBoxFor(t => t.MobileNo)
                            <b class="b">
                                @Model.ErrorMobileNo
                            </b>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp邮&nbsp&nbsp箱&nbsp：
                        </td>
                        <td>@Html.TextBoxFor(t => t.EMail)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            企业分组：
                        </td>
                        <td>
                            @Html.HiddenFor(t => t.CategoryID)
                            @Html.TextBoxFor(t => t.CategoryName)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            结算方式：
                        </td>
                        <td>
                            @Html.DropDownList("PaymentMode", PageHelper.EnterprisePaymentModeSelector(Model.PaymentMode))
                        </td>
                    </tr>
                </table>
                <br />
                <strong>联系人</strong>
                <hr />
                <table>
                    <tr>
                        <td style="width: 80px;">
                            联&nbsp系&nbsp人：
                        </td>
                        <td>@Html.TextBoxFor(t => t.Linkman)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp手&nbsp&nbsp机&nbsp：
                        </td>
                        <td>@Html.TextBoxFor(t => t.LinkmanMobileNo)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp座&nbsp&nbsp机&nbsp：
                        </td>
                        <td>@Html.TextBoxFor(t => t.LinkmanTel)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp传&nbsp&nbsp真&nbsp：
                        </td>
                        <td>@Html.TextBoxFor(t => t.LinkmanFax)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbspE-mail&nbsp：
                        </td>
                        <td>@Html.TextBoxFor(t => t.LinkmanEmail)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp地&nbsp&nbsp区&nbsp：
                        </td>
                        <td>@Html.DropDownList("ProvinceID", PageHelper.ProvinceSelector(Model.ProvinceID))
                            @Html.DropDownList("CityID", PageHelper.CitySelector(Model.CityID, Model.ProvinceID))
                            @Html.DropDownList("AreaID", PageHelper.AreaSelector(Model.AreaID, Model.CityID))
                        </td>
                    </tr>
                    <tr>
                        <td>
                            详细地址：
                        </td>
                        <td>@Html.TextBoxFor(t => t.Address, new { style = "width:500px" })
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp邮&nbsp&nbsp编&nbsp：
                        </td>
                        <td>@Html.TextBoxFor(t => t.PostalCode)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp网&nbsp&nbsp址&nbsp：
                        </td>
                        <td>@Html.TextBoxFor(t => t.WebSiteUrl, new { style = "width:500px" })
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp备&nbsp&nbsp注&nbsp：
                        </td>
                        <td>@Html.TextBoxFor(t => t.Remark, new { style = "width:500px" })
                        </td>
                    </tr>
                </table>
                <br />
                <strong>&nbsp服&nbsp&nbsp务&nbsp</strong>
                <hr />
                <table>
                    <tr>
                        <td style="width: 80px;">
                            业&nbsp务&nbsp员：
                        </td>
                        <td>@Html.HiddenFor(t => t.SalesmanID)
                            @Html.TextBoxFor(t => t.SalesmanIDName)
                        </td>
                    </tr>
                    <tr>
                        <td>
                            客服人员：
                        </td>
                        <td>
                            @Html.HiddenFor(t => t.CustomerServiceID)
                            @Html.TextBoxFor(t => t.CustomerServiceIDName)
                        </td>
                    </tr>
                </table>
            </div>
            <div class="BottomBtn" style="padding-left: 80px;">
                <button class="blue" type="button" onclick="goto('save')">
                    <span>保存</span></button>
                <button class="blue" type="button" onclick="goto('apply')">
                    <span>应用</span></button>
                <button class="blue" type="button" onclick="closeTab()">
                    <span>取消</span></button>
            </div>
        </div>
    }
</body>
</html>
